package com.example.demo.service;

import com.example.demo.dao.ArticleMapper;
import com.example.demo.model.Articleinfo;
import com.example.demo.model.DiscussInfo;
import com.example.demo.model.ReplyInfo;
import com.example.demo.model.vo.ArticleinfoVO;
import com.example.demo.model.vo.ReplyInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    public List<Articleinfo> getListByUid(int uid) {
        return articleMapper.getListByUid(uid);
    }

    public int del(Integer aid, int uid) {
        return articleMapper.del(aid,uid);
    }

    public int add(ArticleinfoVO articleinfoVO) {
        return articleMapper.add(articleinfoVO);
    }

    public Articleinfo getArticleByAndUid(int aid, int uid) {
        return articleMapper.getArticleByAndUid(aid, uid);
    }

    public int update(Articleinfo articleinfo) {
        return articleMapper.update(articleinfo);
    }

    public Articleinfo getArticleById(Integer aid) {
        return articleMapper.getArticleById(aid);
    }

    public int getArtCountByUid(int uid) {
        return articleMapper.getArtCountByUid(uid);
    }

    public int incrementRCount(int aid) {
        return articleMapper.incrementRCount(aid);
    }

    public List<Articleinfo> getListByPage(int psize, int offset) {
        return articleMapper.getListByPage(psize,offset);
    }

    public int getCount() {
        return articleMapper.getArtCount();
    }

    public int updateBook(Articleinfo articleinfo) {
        return articleMapper.updateBook(articleinfo);
    }

    public List<Articleinfo> getArticleByTitle(String title) {
        return articleMapper.getArticleByTitle(title);
    }

    public List<Articleinfo> getArticleByType(String type) {
        return articleMapper.getArticleByType(type);
    }

    public List<Articleinfo> getArticleByTime(String time) {
        return articleMapper.getArticleByTime(time);
    }

    public List<DiscussInfo> getDiscussByAid(int aid) {
        return articleMapper.getDiscussByAid(aid);
    }

    public List<ReplyInfo> getReplyByDid(int did) {
        return articleMapper.getReplyByDid(did);
    }

    public int doDiscuss(DiscussInfo discussInfo) {
        return articleMapper.doDiscuss(discussInfo);
    }

    public Integer getIdByUserAndDiscuss(ReplyInfoVO replyInfoVO){
        return articleMapper.getIdByUserAndDiscuss(replyInfoVO);
    }

    public int addReply(ReplyInfo replyInfo) {
        return articleMapper.addReply(replyInfo);
    }

    public List<Articleinfo> getArticleAll() {
        return articleMapper.getArticleAll();
    }

    public Integer getUidByAid(Integer aid) {
        return articleMapper.getUidByAid(aid);
    }

}
